{%- for category in sources.type_categories|sort %}
    <li class="category" id="c-{{ category.name }}">
    {%- if category.name != None -%}
        <h3>{{ category.label }}</h3>
        {%- if category.description %}
        <div class="description">{{ category.description }}</div>
        {%- endif %}
    {%- endif %}
        <ul class="list-unstyled">
    {%- for type in category.types|sort %}
            <li class="type item" id="t-{{ type.name }}">
                <h4>{{ type.name }}</h4>
        {%- if sources.versions|length > 1 %}
                <div class="diff-header">
                    <h5 class="desc"></h5>
                    <h5 class="diff">
                        <i class="i-side mode-side"></i>
                        <i class="i-inline mode-inline"></i>
                        <i class="i-full mode-full"></i>
                        <i class="i-mini mode-mini"></i>
                        <i class="i-diff"></i>
                         Diff
                    </h5>
                    <ul class="versions list-inline">
            {%- for version in sources.versions|sort %}
                        <li data-version="{{ version.name }}" data-changed="{{ type.changes_status[version.name]|lower }}"
                {%- if version.name not in type.versions -%}
                    data-exists="no"
                {%- else -%}
                    data-exists="yes"
                {%- endif -%}>
                        {{- version.label -}}
                        </li>
            {%- endfor %}
                    </ul>
                </div>
        {%- endif -%}
                <div class="nocontents">no implementation for this version</div>
                <div class="contents">
        {%- include "partial/type_diff.html" -%}
                    <div class="stack sample">
        {%- for version in sources.versions|sort -%}
            {%- if type.changes_status[version.name]|lower in ["new", "updated"] -%}
                        <div data-version="{{ version.name }}
                {%- set seen = False -%}
                {%- for v in sources.versions|sort -%}
                    {%- if seen -%}
                        {%- if type.changes_status[v.name]|lower == "none" %} {{ v.name -}}
                        {%- else -%}
                            {%- set seen = False -%}
                        {%- endif -%}
                    {%- endif -%}
                    {%- if v.name == version.name -%}
                        {%- set seen = True -%}
                    {%- endif -%}
                {%- endfor -%}">
                {%- set type_sample = type.samples[version.name] -%}
                {%- include "partial/type_sample.html" -%}
                        </div>
            {%- endif -%}
        {%- endfor -%}
                    </div>
                </div>
            </li>
    {%- endfor %}
        </ul>
    </li>
{%- endfor -%}